var xhrObject;
var xhrObject2;
function createXHR(){
	
	if(window.ActiveXObject){
		
		xhrObject = new ActiveXObject("Microsoft.XMLHTTP");
		
	}else if(window.XMLHttpRequest){
		
		xhrObject = new XMLHttpRequest();
	}
}
var id;
var BodyTop;

function mass(id){
	var item = $("#massage"+id);
	item.toggle("normal");
}
function Comment(a){
	BodyTop = document.documentElement.scrollTop;
	var item = $("#cm"+a);
	 item.toggle("fast"); 
	id=a;

	
	document.getElementById("cm"+id).innerHTML="";
	createXHR();
	xhrObject.onreadystatechange=resultProcess;
	xhrObject.open("post","/KOMORIUTA/PhotoOldAction.do?action=pt_old_recom&id="+id ,"true");
	xhrObject.send(null);

}



function resultProcess(){
	if(xhrObject.readyState==4){
		if(xhrObject.status==200){
		 document.getElementById("cm"+id).innerHTML=xhrObject.responseText;	
		 document.documentElement.scrollTop=BodyTop;
		}
	}
}

function Comment_write(a){
	
	id=a;
	var contents=$(".oc_contents"+a).val();
	var oc_nick=$("#oc_nick").val();
	alert(contents);
	createXHR();
	xhrObject.onreadystatechange=resultProcess;
	xhrObject.open("post","/KOMORIUTA/PhotoOldAction.do?action=pt_old_recom_write&id="+id+"&oc_contents="+contents+"&oc_nick="+oc_nick ,"true");
	xhrObject.send(null);
}

function Com_cancle(com_id,photo_id){
	id=photo_id;
	var com_id=com_id;
	createXHR();
	xhrObject.onreadystatechange=resultProcess;
	xhrObject.open("post","/KOMORIUTA/PhotoOldAction.do?action=pt_old_com_cancle&id="+com_id+"&oldplus_id="+id ,"true");
	xhrObject.send(null);
}
/*function resultProcess_1(){
	if(xhrObject.readyState==4){
		if(xhrObject.status==200){
			alert(id);
			Comment(id);
		}
	}
}
*/
function doResize(a){  

	var innerBody = a.contentWindow.document.body; 
	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight); 
	a.height = innerHeight; 
	//	alert(innerBody.scrollHeight +" : "+innerBody.offsetHeight);
}   

